const mysqlSourceMapping = [
  {
    label: '选择表名',
    name: 'mTable',
    type: 'select',
    function: 'handleTableChange',
    required: true,
    message: '请选择表名！',
    placeholder: '请选择表名(请先选择数据库连接，若选择后下拉列表无数据则选择的数据库无库表)'
  },
  {
    label: '字段选择',
    name: 'ctreamStr',
    type: 'fieldSelect',
    required: true,
    message: '请选择字段！',
  },
];

const sqlserverSourceMapping = mysqlSourceMapping;
const mongodbSourceMapping = mysqlSourceMapping;
const oracleSourceMapping = mysqlSourceMapping;

const hbaseSourceMapping = [
  {
    label: '选择表名',
    name: 'mTable',
    type: 'select',
    function: 'handleHBaseTableChange',
    required: true,
    message: '请选择表名！',
    placeholder: '请选择表名(请先选择数据库连接，若选择后下拉列表无数据则选择的数据库无库表)'
  },
  {
    label: '选择列族',
    name: 'mColumnFamily',
    type: 'selectColumnFamily',
    function: 'handleTableChange',
    required: true,
    message: '请选择列族！',
    placeholder: '请选择列族(请先选择表名，若选择后下拉列表无数据则选择的库表无列族)'
  },
  {
    label: '字段选择',
    name: 'mStreamStr',
    type: 'fieldSelect',
    required: true,
    message: '请选择字段！',
  },
];

const all = {
  mysqlSourceMapping,
  sqlserverSourceMapping,
  oracleSourceMapping,
  mongodbSourceMapping,
  hbaseSourceMapping
};

function mergeConfig(dbType){
  let dataset = {};
  dataset[dbType] = {};
  dataset[dbType]["formSourceMapping"] = all[`${dbType}SourceMapping`];
  // dataset[dbType]["sourceFormData"] = all[`_${dbType}SourceFormData`]
  // dataset[dbType]["srcDBUrl"] = all[`${dbType}Url`];
  return dataset[dbType];
}

export {mergeConfig};